import React,{Suspense} from 'react'
import { Switch, Route, Redirect } from "react-router-dom"
let Login=React.lazy(()=>import('./pages/Login/Login'))
let Register=React.lazy(()=>import('./pages/Register/Register'))
let Index=React.lazy(()=>import('./pages/Index/Index'))

function App() {
  return (
    <div>
     <React.Suspense fallback={<div>正在加载中。。。。</div>}>
        {/* 路由出口 */}
        <Switch>
           {/* 路由规则 */}
          <Route path="/login" component={Login}></Route>
          <Route path="/register" component={Register}></Route>
          <Route path="/index" component={Index}></Route>
          {/* 重定向 */}
          <Redirect to='/login'></Redirect>
        </Switch>
      </React.Suspense>
    </div>
  );
}

export default App;
